<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	
<%@include file="/include/head.jsp"%>

<div id="cc" class="easyui-layout" style="width:100%;height:100%;">   
	<div data-options="region:'center',title:'销售订单-${vo.orderDate}信息'" style="padding:5px;background:#eee;">
		<form id="editForm"   method="post" enctype="multipart/form-data" >
			<input name="id" type="hidden" value="${vo.id}">
			<input name="cusId" id="cusId" type="hidden" value="${vo.cusId}">
			<input name="status" id="status" type="hidden" value="0">
			<input name="totalAmount" id="totalAmount" type="hidden" value="0.0">
				<!-- 提交的时候存放子表订单明细信息 -->
			<table cellpadding="0" cellspacing="1" class="formtable">
				<tr>
				<td align="right"><label class="Validform_label">客户:</label></td>
				<td class="value">
				<input class="easyui-textbox" type="text"  id="cusName" name="cusName"
				 data-options="required:true" value="${vo.cusName}" />
				</td>
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">订单日期:</label></td>
				<td class="value">
				<input class="easyui-datebox" type="text"  id="orderDate" name="orderDate"
				 data-options="required:true" value="${vo.orderDate}" />
				</td>
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">订单类型:</label></td>
				<td class="value">
				<select class="easyui-combobox"    id="orderType" name="orderType"
				 data-options="required:true"   >
				 <option value="合同订单" <c:if test="${vo.orderType=='合同订单'}"> selected="selected"</c:if> > 合同订单</option>
				 <option value="其它订单" <c:if test="${vo.orderType=='其它订单'}"> selected="selected"</c:if> >其它订单</option>
				 </select>
				</td>
				</tr>
				<tr>
				<td align="right"><label class="Validform_label">备注:</label></td>
				<td class="value" colspan="3">
				<textarea class="easyui-textbox" type="text" multiline="true" id="remark" name="remark"
				 data-options="width:300,height:60"   >${vo.remark}</textarea>
				</td>
				</tr>
				
			</table>
		</form>
	</div>
	<div data-options="region:'south'" style="height:35px;text-align: center;padding-top: 5px">
	 	<a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="save()" >保存</a>  
	 	<a id="btncancel" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="closeDialog()">关闭</a>  
	 </div>
</div>

 
<script type="text/javascript">
var dialog = frameElement.dialog;
$(function() {
	$('#cusName').textbox({    
	    buttonText:'Search',    
	    onClickButton:function(){
	    	CustomerDialog('cusId','cusName',false,function(data){
	    		var selRow = data.data[0];
	    	})	;
	    }
	});
	$('#editForm').form({    
	    url:'saveOrUpdate.do', 
	    iframe:false,   
	    onSubmit: function(){ 
	    	//do your things on submint
	    },    
	    success:function(data){    
	    	data = JSON.parse(data);
	    	if(data.result == '1')
	    	{
	    		$.messager.alert("保存结果","保存成功",'info',function(){
	    			if($.isFunction(dialog.dialog('options').callback))
	    			{
	    				dialog.dialog('options').callback(data);
	    			}
	    			document.location.href="editForm.do?id=" + data.data.id;
		    	});	
	    	}
	    	else
	    	{
	    		$.messager.alert("保存结果","保存失败：" + data.message,'error',function(){
	    			
		    	});
	    	}
	    }    
	});
});

function save(){
	//验证表单
	if(!$("#editForm").form('validate'))
	{
		
		$.messager.alert("验证结果","表单验证失败",'error',function(){
    	});
		return;
	}
	$("#editForm").submit();  
}
function closeDialog()
{
	dialog.dialog("close");
}

</script>
